using ApiProject.Api.Entity;
using System.Linq;
using Microsoft.EntityFrameworkCore;
using System;

namespace ApiProject.Api.Data
{
    public class ApiProjectDb : DbContext
    {


        public ApiProjectDb(DbContextOptions options) : base(options)
        {

        }
        public DbSet<Users> Users { get; set; }
        public DbSet<UserInfo> UserInfo { get; set; }
        public DbSet<Roles> Roles { get; set; }
        public DbSet<AuditInfo> AuditInfo { get; set; }
        public DbSet<Attention> Attention { get; set; }
        public DbSet<AuthorityManagement> AuthorityManagement { get; set; }
        public DbSet<Commodities> Commodities { get; set; }
        public DbSet<CommodityClassifications> CommodityClassifications { get; set; }
        public DbSet<CommodityDetails> CommodityDetails { get; set; }
        public DbSet<CommodityDetailPicture> CommodityDetailPicture { get; set; }
        public DbSet<ComSpecifications> ComSpecifications { get; set; }
        public DbSet<EmporiumInfo> EmporiumInfo { get; set; }
        public DbSet<Estimates> Estimates { get; set; }
        public DbSet<Orders> Orders { get; set; }
        public DbSet<OrderInfo> OrderInfo { get; set; }
        public DbSet<Payment> Payment { get; set; }
        public DbSet<ReceivingIdInfo> ReceivingIdInfo { get; set; }
        public DbSet<RoleAuthorty> RoleAuthorty { get; set; }
        public DbSet<ShoppingCar> ShoppingCar { get; set; }
        public DbSet<Specifications> Specifications { get; set; }
        public DbSet<AdImage> AdImage { get; set; }
        public DbSet<SpecificationChildrens> SpecificationChildrens { get; set; }

        protected override void OnModelCreating(ModelBuilder model)
        {

                model
           .Entity<Roles>()
           .HasData(new Roles
           {
               Id=1,
               RoleName = "管理员",
           }
   
           ); model
           .Entity<UserInfo>()
           .HasData(new UserInfo
           {
               Id = 1,
               NickName = "Boos",
               Sex = "男",
               Birthday = DateTime.Now,
               Telephone = "12345664456",
               Dzyx = "2589658445@qq.com",
               Address = "闽大",
               SelfIntroduction = "666",
               UserId=1,
           });
           model
           .Entity<Users>()
           .HasData(new Users
           {
               Id = 1,
               Username = "admin",
               Password = "123456",
               RolesId = 1,
            //    UserInfoId=1,
           }
            

           );

         
           

          
           

            


           

          


          

       }


       

    }
}
